﻿using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using Maticsoft.DBUtility;//Please add references
namespace Maticsoft.DAL
{
	/// <summary>
	/// 数据访问类:Books
	/// </summary>
	public partial class Books
	{
        /// <summary>
        /// 根据Id号批量删除记录
        /// </summary>
        /// <param name="ids">逗号隔开的id串</param>
        /// <returns>影响行数</returns>
        public int DeleteByIds(string ids)
        {
            string strSql = "update books set IsActive=0 where bookId in(" + ids + ")";
            return DbHelperSQL.ExecuteSql(strSql);
        }

        public int HiddenShow(string ids, int opeType)
        {
            string strSql = "update books set IsHid=" + opeType + " where bookId in(" + ids + ")";
            return DbHelperSQL.ExecuteSql(strSql);
        }

        /// <summary>
        /// 批量修改销售价格
        /// </summary>
        /// <param name="ids">逗号隔开的id串</param>
        /// <param name="salePrice">修改后销售价格</param>
        /// <param name="salePrice">修改方式（0为id 1为分类）</param>
        /// <returns>影响行数</returns>
        public int ModifySalePriceByIds(string ids, string salePrice,string flag)
        {
            string strSql = string.Empty;
            if (flag == "0")
            {
                strSql = "update books set salePrice=" + salePrice + " where bookId in(" + ids + ")";
            }
            else
            {
                strSql = "update books set salePrice=" + salePrice + " where categoryId=" + ids;
            }
            return DbHelperSQL.ExecuteSql(strSql);
        }
	}
}

